package com.s3.khospitalds.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.s3.khospitalds.entity.Patienthosp;
import com.s3.khospitalds.entity.Patientlist;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author: xw
 * @CreateTime: 2025/3/6
 * @Description: 住院患者档案表
 * @Version: 1.0
 */
@Mapper
@Repository
public interface PatienthospMapper extends BaseMapper<Patienthosp> {
    @Insert("INSERT INTO patienthosp VALUE\n" +
            "(NULL,#{name},#{age} ,#{sex} ,#{phone} ,#{idcard} ,#{homeaddr} ,#{doctor}  ,#{nurse} ,#{patientcond} ,#{txstatus} ,#{medstatus} ,#{precautions} ,#{admtime} ,#{disctime} ,#{admaddr} ,#{hospcosts} );")
    public int insertPatienthosp(Patienthosp patienthosp);
    @Select("SELECT * FROM patienthosp WHERE `name` LIKE concat('%',#{name},'%')")
    public List<Patienthosp> selectName(@Param("name") String name);
    @Update("UPDATE patienthosp SET `name`=#{name} ,age=#{age},sex=#{sex} ,phone=#{phone} ,idcard=#{idcard} ,homeaddr=#{homeaddr} ,doctor=#{doctor} ,nurse=#{nurse} ,patientcond=#{patientcond} ,txstatus=#{txstatus} ,medstatus=#{medstatus} ,Precautions=#{precautions} ,admtime=#{admtime} ,disctime=#{disctime} ,admaddr=#{admaddr} ,hospcosts=#{hospcosts}   WHERE id=#{id} ")
    public int updateName(Patienthosp patienthosp);
    @Delete("DELETE FROM patienthosp WHERE id=#{id}")
    public int deleteById(Integer id);
}
